#include "Avalon/ServiceLocator/ServiceEntry.hpp"
#include "Avalon/Serialization/DataShuttle.hpp"

using namespace Avalon;
using namespace Avalon::Serialization;
using namespace Avalon::ServiceLocator;
using namespace std;

ServiceEntry::ServiceEntry() {}

ServiceEntry::ServiceEntry(const string& name, const string& details, int id,
    const DirectoryEntry::Tag& account)
    : m_name(name),
      m_details(details),
      m_id(id),
      m_account(account) {}

const string& ServiceEntry::GetName() const {
  return m_name;
}

const string& ServiceEntry::GetDetails() const {
  return m_details;
}

int ServiceEntry::GetId() const {
  return m_id;
}

const DirectoryEntry::Tag& ServiceEntry::GetAccount() const {
  return m_account;
}

bool ServiceEntry::operator ==(const ServiceEntry& lhs) const {
  return m_id == lhs.m_id;
}

bool ServiceEntry::operator !=(const ServiceEntry& lhs) const {
  return !(*this == lhs);
}

void ServiceEntry::Shuttle(DataShuttle* shuttle, unsigned int version) {
  shuttle->Shuttle("name", m_name);
  shuttle->Shuttle("details", m_details);
  shuttle->Shuttle("id", m_id);
  shuttle->Shuttle("account", m_account);
}
